package cn.ustb.dao;

import cn.ustb.entity.JwTeacherInformation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface JwTeacherInformationDao {
    @Select("select * from jwteacherinformation")
    List<JwTeacherInformation> getAll();

    @Select("select * from jwteacherinformation where teacherId = #{teacherId}")
    JwTeacherInformation get(String teacherId);

    @Insert("insert into jwteacherinformation values(#{teacherId},#{teacherName},#{gender},#{politicState},#{nation},#{nativePlace},#{academy},#{qq},#{phone},#{email},#{address})")
    void insert(JwTeacherInformation teacher);

    @Update("update jwteacherinformation set TeacherName = #{teacherName},Gender = #{gender}, Politicstatus = #{politicstatus}, Nation = #{nation}, Nativeplace = #{nativePlace}, Academy = #{academy}, qq = #{qq}, Phone = #{phone}, Email = #{email}, Address = #{address} where teacherId = #{teacherId}")
    void update(JwTeacherInformation teacher);

    @Delete("delete from jwteacherinformation where teacherId = #{teacherId}")
    void delete(String teacherId);

    @Select("select count(*) from jwteacherinformation where teacherId = #{teacherId}")
    long getCountWithName(String teacherId);
}
